
<template>
    <div class="main">
        <button @click="doDec">减</button>
        <span>{{count}}</span>
        <button @click="doAdd">加</button>
    </div>
</template>
<script>
    import { mapGetters, mapActions} from 'vuex';
    export default {
        data(){
            return{};
        },
        computed:{
            ...mapGetters(['count']),
        },
        methods:{
            ...mapActions([
                'doAdd',
                'doDec'
            ])
        },
        destroyed(){console.log('destroyed')}
    }
</script>
<style scoped>
    .main{text-align:center;  font-size:2rem; }
</style>